package com.lanyou.esb.servicemix.monitor.console;

import org.apache.sshd.ClientChannel;
import org.apache.sshd.ClientSession;
import org.apache.sshd.SshClient;
import org.apache.sshd.client.future.ConnectFuture;

/**
 * Created by gonglei on 16/4/11.
 */
public class OsgiConnect {

//    public static void main(String[] args) throws Exception {
//        String host = "localhost";
//        int port = 8101;
//        String user = "karaf";
//        String password = "karaf";
//
//        SshClient client = null;
//        try {
//            client = SshClient.setUpDefaultClient();
//            client.start();
//            ConnectFuture future = client.connect(host, port);
//            future.await();
//            ClientSession session = future.getSession();
//            session.authPassword(user, password);
//            ClientChannel channel = session.createChannel("shell");
//            channel.setIn(System.in);
//            channel.setOut(System.out);
//            channel.setErr(System.err);
//            channel.open();
//            channel.waitFor(ClientChannel.CLOSED, 0);
//        } catch (Throwable t) {
//            t.printStackTrace();
//            System.exit(1);
//        } finally {
//            try {
//                client.stop();
//            } catch (Throwable t) { }
//        }
//        System.exit(0);
//    }

}
